The present invention relates in general to binary coding circuits of the type used for analog signals. More specifically, the present invention provides a binary coding circuit for quantizing the output of a photoelectric conversion cell in an optical character reader (OCR). It quantizes the photoelectric conversion cell output into a binary signal having two values corresponding to a background area and a character or symbol area.
The term "character" as used herein includes any kind of character or symbol. Thus, the term includes, but is not limited to alpha-numeric characters, symbols, Japanese "kana", etc. The term "symbol" includes but is not limited to bar codes, etc. Characters are often printed black on white paper. The characters can be discriminated from a blank space by discerning a difference between white and black. However, the paper which forms the background of the characters is not always white. This makes it more difficult to discern between the character and background. The area where characters are printed is hereinafter referred to as a "character area". In contrast, the blank space, where no character is printed, is hereinafter referred to as a "background area".
The term "optical character reader" (OCR) is used in a broad sense to include various types of apparatus for optically reading characters imprinted on a surface. In a typical OCR, the surface to be read is illuminated with light. A lens system images light reflected from the surface onto a matrix of photoelectric cnversion cells. These cells provide output signals that are responsive to the intensity of light on the cells. Output signals of the cells are converted by a binary coding circuit into binary signals indicating character areas and background areas. Characters are discriminated on the basis of the binary signal.
Light incident on the photoelectric conversion cells varies in accordance with the imprinted characters. Because the characters are black and the background is white, the level of incident light varies corresponding to the existence of characters.
However, there are operational difficulties with OCRs. Characters written on the paper may not always be imprinted evenly on a page being read. Also, the output of a photoelectric conversion cell scanning the paper does not always take one of two values corresponding to black or white. Rather, it may vary continuously and irregularly. Even if the characters are printed using type, a character may not be formed exactly the same each time. Also, characters vary from one another in shape and size, number of strokes, etc. The output of a photoelectric conversion cell thus may vary widely in an analog manner and its output may change both spatially and temporally.
The output does not simply take either one of a maximum value and a minimum value. Rather, the output continuously varies between the maximum and minimum values. A simple binary coding method for converting such an analog concentration signal into a binary signal is to compare it with a fixed threshold level. However, this binary coding method has a disadvantage in that the character area is often mistaken or misjudged for background area. Characters are often at least partially missed.
The simply binary coding method has a further disadvantage in that the background area is often mistaken for character area. The characters may be defaced or obscured by stains between character lines, etc. If character recognition is made on the basis of the binary-coded data in the manner as described above, many errors result.
The term "threshold level" as used herein refers to a value that is compared with the amplitude of a signal. As the result of comparison, an output signal of "0" or "1" is generated, where the "0" or "1" constitutes a binary code. If the threshold level is fixed, the aforementioned problems exist. Accordingly, a fixed threshold level can not be used unless the characters are extremely simple. Japanese Patent Publication No. 37952/1985 discloses a technique in which four different thresholds are used to binary code the output of a photoelectric conversion cell. Of the four thresholds, one which may provide an optimum result of binary coding is selected.
The procedure of determining the optimum threshold will now be described. The characters have line widths that vary from character to character. The line width of a character printed in Gothic type is large in comparison with the same character printed in a different "font". Even for characters printed with the same font, the line width of characters may vary from character to character depending on calligraphic style. Further, some lines of a particular character may be thicker than other lines of the same character. For example, vertical lines of a certain character may be thicker than horizontal lines of the same character, or vice versa and the width of one line in a character may vary from one end of the line to the other.
According to the Japanese Patent Publication No. 37952/1985, an optimum threshold is selected on the basis of the change of the line width. A large number of arithmetic operations are required to do this. It can be said that an average line width of characters printed using a certain type font is generally within a predetermined range. The following equation applies so that line width can be computed. ##EQU1## In the equation, the term "number of black points" means the number of black meshes (picture elements) in the whole picture scene. The term "number of surrounding points" means the number of black picture elements on the boundary of white and black areas.
Assume that, for example, a character is simply constituted by a horizontal bar "-" which includes black picture elements of r and q in number arranged in rows and columns respectively (q&gt;&gt;r). The number of black points is r.times.q, and the number of surrounding points is (2q+2r-2). The real line width of the character is r. Accordingly, the line width W as defined by the above equation is approximately r/2. It thus may be said that the line width W is defined as the half width of the real character line.
The average line width of characters printed in a certain type font can be obtained by repeating such arithmetic operations on all characters. Assume that W is known to be 1.5 with respect to a certain group of characters belonging to a certain dictionary pattern. Assume that a typescript is made up of the group of characters contained in the dictionary pattern. The typescript is optically read and the resulting signal is binary coded by comparing it with four separate and distinct threshold levels U.sub.1, U.sub.2, U.sub.3 and U.sub.4. Four binary patterns can be thus obtained to thereby determine black-and-white picture elements. With respect to the four patterns, the number of black points and the number of surrounding points are counted to thereby calculate the line width.
If the threshold level is too low, the number of black points is excessively increased so that the line becomes thick, that is, the line width becomes large. If the threshold level is too high, the number of white points is excessively increased so that the line becomes thin, that is, the line width becomes small. Thus, four values of line width, W.sub.1, W.sub.2, W.sub.3, and W.sub.4, can be calculated. Because the average line width W of the characters contained in the dictionary pattern is predetermined, an optimum one that approaches W is selected from the four values of line width, W.sub.1, W.sub.2, W.sub.3 and W.sub.4. Accordingly, one binary pattern is selected from the four binary-coding patterns on the basis of the thus selected optimum line width.
According to the Japanese Patent Publication No. 37952/1985, binary coding is performed by use of four threshold levels to thereby calculate values of line width. The calculated values of line width are compared with a predetermined value of line width to thereby select an optimum one of the calculated values of line width which is the most approximate to the predetermined one. This method lacks reliability and a large number of arithmetical operations are required.
Also, because it is necessary to calculate four binary patterns, it is necessary to have a picture memory with a capacity that is four times larger than would otherwise be necessary. If binary-coding processing is performed to obtain the four binary patterns simultaneously, the number of comparator circuits and the like must be multiplied by four. If the binary-coding processing is performed sequentially, on the other hand, the time required to process is four times that which would otherwise be required.
The number of black points and the number of surrounding points should be counted according to every pattern. The time required for counting the number of surrounding points is long, because the boundary of white and black must be detected. Furthermore, the line width in the dictionary pattern should be predetermined, which is one of the most difficult aspects of this technique. It is necessary to apply it to various kinds of characters. That is, the range of use is limited to specific kinds of characters. However, it is desired that any character be read even if the character has any line width.
A further disadvantage occurs with the four threshold arrangement. Although four thresholds U.sub.1 -U.sub.4 are used, those thresholds are used in the alternative. Once a threshold is selected, it is used for the whole picture. The local characteristics of the picture are not considered. If the character is so complex that two peaks are near to each other, the output between the peaks is not zero. Rather, the output is "drawn up" by the two peaks, and it is difficult to discriminate the intermediate output from the peaks. Accordingly, the space between two lines becomes "smeared".
To detect the space between lines, it is necessary to identify a small level difference between the intermediate value and each peak value. This is however, impossible as long as a single threshold level is used throughout the entire picture. The use of a locally variable threshold level would make it possible to detect local characteristics.
As discussed above, the binary coding circuit according to the Japanesse Patent Publication No. 37952/1985 has the further disadvantages of large circuit scale and high cost. Also, real time processing and use for all types of characters are impossible.